package com.umakr.ax.app.web;

import com.umakr.ax.common.service.RadioStationService;
import com.umakr.ax.common.service.RadioStationShowService;
import com.umakr.ax.core.base.AbstractController;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * <p>
 * 电台信息  前端控制器
 * </p>
 *
 * @author Umakr-Code-Generator
 * @since 2017-12-30
 */
@Controller
@RequestMapping("/api/radioStation")
public class RadioStationAppController extends AbstractController {

	@Autowired
	RadioStationService radioStationService;
	@Autowired
	RadioStationShowService radioStationShowService;

	@ApiOperation(value = "获取电台列表")
	@GetMapping("/listRadio")
		public Object listRadio(ModelMap modelMap, Integer type ,Long userId ,String areaCode ) {
		return setSuccessModelMap(modelMap,radioStationService.listRadio(type,userId,areaCode));
	}

	@ApiOperation(value = "根据用户id获取电台信息")
	@GetMapping("/getRadioInfoByUserId")
	public Object getRadioInfoByUserId(ModelMap modelMap, @RequestParam(name = "userId")Long userId ,@RequestParam(name = "rsId")Long rsId,@RequestParam(name = "areaCode")String areaCode ) {
		return setSuccessModelMap(modelMap,radioStationService.getRadioInfoByUserId(userId,rsId,areaCode));
	}

	@ApiOperation(value = "根据电台编码获取电台信息")
	@GetMapping("/getRadioInfoByRsCode")
	public Object getRadioInfoByRsCode(ModelMap modelMap, @RequestParam(name = "rsCode")String rsCode ) {
		return setSuccessModelMap(modelMap,radioStationService.getRadioInfoByRsCode(rsCode));
	}

	@ApiOperation(value = "获取本台推荐列表 前五条数据")
	@GetMapping("/listRecommendRadioStationShow")
	public Object listRecommendRadioStationShow(ModelMap modelMap, @RequestParam(name = "rsId") Long rsId,Long userId) {
		return setSuccessModelMap(modelMap,radioStationShowService.listRecommendRadioStationShow(rsId,userId));
	}

}